def max_sum(nums):
    max_current = max_global = nums[0]
#循环数组，找出子数组最大的值
    for i in range(1, len(nums)):
        max_current = max(nums[i], max_current + nums[i])
        if max_current > max_global:
            max_global = max_current

    return max_global


# 输入数组
input_array = input("请输入整数数组（用逗号分隔）：")
array = list(map(int, input_array.split(',')))

# 计算最大子数组之和
result = max_sum(array)
print("子数组之和的最大值是:", result)